package cn.tedu.ivos.web.controller;

import cn.tedu.ivos.web.model.RestResult;
import cn.tedu.ivos.web.model.RestResultUtils;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/api")
public class ResourceController {

    @PreAuthorize("hasAuthority('system:notice:list')")
    @GetMapping("/select")
    public RestResult<String> helloSelect() {
        String data= "Hello from a select endpoint! You don't need to be authenticated to see this.";
        return RestResultUtils.success(data);
    }
    @PreAuthorize("hasAuthority('sys:private:view')")
    @PutMapping("/update")
    public RestResult<String>  helloUpdate() {
        String data= "Hello from a update endpoint! You need to be authenticated to see this.";
        return RestResultUtils.success(data);
    }

}
